package com.iwdnb.gkgz.infrastructure.dao.repo;

import java.util.Date;
import java.util.List;

import com.iwdnb.gkgz.infrastructure.dao.entity.StockDayDataDO;

public interface StockDayDataRepository {

    //@Query(value = "select * from t_stock_day t where t.code= :code and t.date = :date",nativeQuery = true)
    StockDayDataDO queryDate(String code,  String date);

    //@Query(value = "select * from t_stock_day t where t.code= :code and t.date >= :date",nativeQuery = true)
    List<StockDayDataDO> queryAllByDateAfter( String code, String date);

    //@Query(value = "select * from t_stock_day t where t.code= :code and t.date >= :startDate and t.date <= :endDate",nativeQuery = true)
    List<StockDayDataDO> queryAllByDateRange( String code, String startDate, String endDate);

    //@Query(value = "select * from t_stock_day t where t.code= :code and t.date <= :endDate ORDER BY DATE DESC LIMIT 1,1",nativeQuery = true)
    StockDayDataDO queryDayBeforeData( String code,  String endDate);


    //@Query(value = "select * from t_stock_day t where t.code= :code and t.date like :date%",nativeQuery = true)
    List<StockDayDataDO> queryAllByYear( String code, String date);

    void save(StockDayDataDO stockDayDataDO);

    void deleteByDateAfterAndDateBefore(Date startDate, Date endDate);

    void saveAll(List<StockDayDataDO> stockDayDataDOList);
}